<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.js"></script>
</head>
<body>
   <button>点击</button>
</body>
</html>
<script>
    const btn=document.querySelector('button')
    axios.defaults.baseURL='http://pcapi-xiaotuxian-front-devtest.itheima.net'
    btn.onclick=function(){
        axios.get('/goods/?id=3828009',{
            headers: { 
            'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
                     }
        }).then(response=>{
           console.log(response.data)
        })
    }

</script>